package com.swust.book_shop.exception;

import com.swust.book_shop.pojo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author liushuai
 * @create 2022-05-20 15:34
 */
@ControllerAdvice
public class GlobalException {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handlerException(Exception e){
        return  Result.fail(e.getMessage());
    }
}
